package com.cal.calonecal.service.impl;

import com.cal.calonecal.common.Response;
import com.cal.calonecal.mapper.TagMapper;
import com.cal.calonecal.pojo.entity.Tag;
import com.cal.calonecal.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 76004
 * @apiNote
 * @date 2023/6/17 21:08
 */
@Service
public class TagServiceImpl implements TagService {
    @Autowired
    private TagMapper tagMapper;
    @Override
    public Response<Void> add(Tag tag) {
        tagMapper.insert(tag);
        return Response.success();
    }

    @Override
    public Response<Void> delete(long id) {
        tagMapper.deleteById(id);
        return Response.success();
    }

    @Override
    public Response<Void> update(Tag tag) {
        tagMapper.updateById(tag);
        return Response.success();
    }

    @Override
    public Response<Tag> selectById(long id) {
        return Response.success(tagMapper.selectById(id));
    }
}
